﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using gameConfigurations;

namespace WebInterface
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        private Configurations configurations;

        private void DataBindTextBox()
        {
            configurations = Configurations.getInstance();
            txtConsumptionGR.Text = configurations.consumptionGrowthRate.ToString("F2");
            txtCycleDuration.Text = configurations.cycleDuration.ToString("F2");
            txtEfficiencyDR.Text = configurations.efficiencyDegradationRate.ToString("F2");
            txtHealthDR.Text = configurations.healthDegradationRate.ToString("F2");
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DataBindTextBox();
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            configurations = Configurations.getInstance();

            configurations.consumptionGrowthRate = Decimal.Parse(txtConsumptionGR.Text);
            configurations.cycleDuration = Decimal.Parse(txtCycleDuration.Text);
            configurations.efficiencyDegradationRate = Decimal.Parse(txtEfficiencyDR.Text);
            configurations.healthDegradationRate = Decimal.Parse(txtHealthDR.Text);
            DataBindTextBox();
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            configurations.consumptionGrowthRate = 1.0M;
            configurations.cycleDuration = 100;
            configurations.efficiencyDegradationRate = 0.1M;
            configurations.healthDegradationRate = 1.0M;
            DataBindTextBox();
        }

        
    }
}
